<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>lp</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_001_014_1251">&nbsp;</a>NAME</h4><blockquote>
lp - send files to a printer
</blockquote><h4><a name = "tag_001_014_1252">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

lp <b>[</b>-c<b>][</b>-d <i>dest</i><b>][</b>-n <i>copies</i><b>][</b>-msw<b>][</b>-o <i>option</i><b>]</b>... <b>[</b>-t <i>title</i><b>]
[</b><i>file</i>...<b>]</b>
</code>
</pre>
</blockquote><h4><a name = "tag_001_014_1253">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>lp</i>
utility copies the input files to an output destination
in an unspecified manner.
The default output destination should be to a hardcopy device, such
as a printer or microfilm recorder, that produces non-volatile,
human-readable documents.
If such a device is not available to the application,
or if the system provides no such device, the
<i>lp</i>
utility
will exit with a non-zero exit status.
<p>
The actual writing to the output device may occur some
time after the
<i>lp</i>
utility successfully exits.
During the portion of the writing that corresponds
to each input file, the implementation
guarantees exclusive access to the device.
<p>
The
<i>lp</i>
utility associates a unique
<i>request ID</i>
with each request.
<p>
Normally, a banner page is produced to separate and identify each print job.
This page may be suppressed by implementation-dependent conditions,
such as an operator command or one of the
<b>-o</b>&nbsp;<i>option</i>
values.
</blockquote><h4><a name = "tag_001_014_1254">&nbsp;</a>OPTIONS</h4><blockquote>
The
<i>lp</i>
utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b>&nbsp;</a> .
<p>
The following options are supported:
<dl compact>

<dt><b>-c</b>
<dd>Exit only after further access to any of the input files
is no longer required.
The application can then safely delete or modify the files
without affecting the output operation.
Normally,
files will not be copied, but will be linked whenever possible.
If the
<b>-c</b>
option is not given, then the user should be careful
not to remove any of the files
before the request has been printed in its entirety.
It should also be noted that in the absence of the
<b>-c</b>
option, any changes made to the named files
after the request is made but before it is printed
will be reflected in the printed output.
On some systems,
<b>-c</b>
may be on by default.

<dt><b>-d&nbsp;</b><i>dest</i>
<dd>
Specify a string that names the destination (dest).
If
<i>dest</i>
is a printer, the request will be printed only
on that specific printer.
If
<i>dest</i>
is a class of printers, the request will be printed
on the first available printer that is a member of the class.
Under certain conditions (printer unavailability,
file space limitation, and so on), requests for
specific destinations need not be accepted; see
<i><a href="lpstat.html">lpstat</a></i>.
Destination names vary between systems; see
<i><a href="lpstat.html">lpstat</a></i>.

If
<b>-d</b>
is not specified, and neither the
<i>LPDEST</i>
nor
<i>PRINTER</i>
environment variable is set, an unspecified destination is used.
The
<b>-d</b>&nbsp;<i>dest</i>
option takes precedence over
<i>LPDEST ,
</i>which in turn takes precedence over
<i>PRINTER .
</i>Results are undefined when
<i>dest</i>
contains a value that is not a valid destination name.

<dt><b>-m</b>
<dd>Send mail (see
<i><a href="mailx.html">mailx</a></i>)
after the files have been printed.
By default, no mail is sent upon normal completion
of the print request.

<dt><b>-n&nbsp;</b><i>copies</i>
<dd>
Write
<i>copies</i>
number of copies of the files, where
<i>copies</i>
is a positive decimal integer.
The methods for producing multiple copies and for arranging
the multiple copies when multiple
<i>file</i>
operands are used are unspecified, except
that each file will be output as an integral
whole, not interleaved with portions of other files.

<dt><b>-o&nbsp;</b><i>option</i>
<dd>
Specify printer-dependent or class-dependent
<i>option</i>s.
Several such
<i>option</i>s
may be collected by specifying the
<b>-o</b>
option more than once.

<dt><b>-s</b>
<dd>Suppress messages from
<i>lp</i>
such as &quot;request id is ...&quot;.

<dt><b>-t&nbsp;</b><i>title</i>
<dd>Write
<i>title</i>
on the banner page of the output.

<dt><b>-w</b>
<dd>Write a message on the user's terminal after the
files have been printed.
If the user is not logged in, then mail will be sent instead.

</dl>
</blockquote><h4><a name = "tag_001_014_1255">&nbsp;</a>OPERANDS</h4><blockquote>
The following operand is supported:
<dl compact>

<dt><i>file</i><dd>A pathname of a file to be output.
If no
<i>file</i>
operands are specified,
or if a
<i>file</i>
operand is "-", the standard input will be used.
If a
<i>file</i>
operand is used, but the
<b>-c</b>
option is not specified, the process performing the writing
to the output device may have user and group permissions
that differ from that of the process invoking
<i>lp</i>.

</dl>
</blockquote><h4><a name = "tag_001_014_1256">&nbsp;</a>STDIN</h4><blockquote>
The standard input will be used only if no
<i>file</i>
operands are specified,
or if a
<i>file</i>
operand is "-".
See the INPUT FILES section.
</blockquote><h4><a name = "tag_001_014_1257">&nbsp;</a>INPUT FILES</h4><blockquote>
The input files must be text files.
</blockquote><h4><a name = "tag_001_014_1258">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>
The following environment variables affect the execution of
<i>lp</i>:
<dl compact>

<dt><i>LANG</i><dd>Provide a default value for the internationalisation variables
that are unset or null.
If
<i>LANG</i>
is unset or null, the corresponding value from the
implementation-dependent default locale will be used.
If any of the internationalisation variables contains an invalid setting, the
utility will behave as if none of the variables had been defined.

<dt><i>LC_ALL</i><dd>
If set to a non-empty string value,
override the values of all the other internationalisation variables.

<dt><i>LC_CTYPE</i><dd>
Determine the
locale for the interpretation of sequences of bytes of text data as
characters (for example, single- as opposed to multi-byte characters
in arguments and input files).

<dt><i>LC_MESSAGES</i><dd>
Determine the locale that should be used to affect
the format and contents of diagnostic
messages written to standard error
and informative messages written to standard output.

<dt><i>LC_TIME</i><dd>
Determine the format and contents of date and
time strings displayed in the
<i>lp</i>
banner page, if any.

<dt><i>LPDEST</i><dd>
Determine the destination.
If the
<i>LPDEST</i>
environment variable is not set,
the
<i>PRINTER</i>
environment variable will be used.
The
<b>-d</b>&nbsp;<i>dest</i>
option takes precedence over
<i>LPDEST .
</i>Results are undefined when
<b>-d</b>
is not specified and
<i>LPDEST</i>
contains a value that is not a valid destination name.

<dt><i>NLSPATH</i><dd>
Determine the location of message catalogues
for the processing of
<i>LC_MESSAGES .
</i>
<dt><i>PRINTER</i><dd>
Determine the output device or destination.
If the
<i>LPDEST</i>
and
<i>PRINTER</i>
environment variables are not
set, an unspecified output device is used.
The
<b>-d</b>&nbsp;<i>dest</i>
option and the
<i>LPDEST</i>
environment variable takes precedence over
<i>PRINTER .
</i>Results are undefined when
<b>-d</b>
is not specified,
<i>LPDEST</i>
is unset, and
<i>PRINTER</i>
contains a value that is not a valid device or destination name.

</dl>
</blockquote><h4><a name = "tag_001_014_1259">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_001_014_1260">&nbsp;</a>STDOUT</h4><blockquote>
The
<i>lp</i>
utility
writes a
<i>request ID</i>
to the standard output, unless
<b>-s</b>
is specified.
The format of the message is unspecified.
This
<i>request ID</i>
can be used later to cancel (see
<i><a href="cancel.html">cancel</a></i>)
or find the status (see
<i><a href="lpstat.html">lpstat</a></i>)
of the request.
</blockquote><h4><a name = "tag_001_014_1261">&nbsp;</a>STDERR</h4><blockquote>
Used only for diagnostic messages.
</blockquote><h4><a name = "tag_001_014_1262">&nbsp;</a>OUTPUT FILES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_1263">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_1264">&nbsp;</a>EXIT STATUS</h4><blockquote>
The following exit values are returned:
<dl compact>

<dt>0<dd>All input files were processed successfully.

<dt>&gt;0<dd>No output device was available, or an error occurred.

</dl>
</blockquote><h4><a name = "tag_001_014_1265">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_001_014_1266">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
The
<i><a href="pr.html">pr</a></i>
and
<i><a href="fold.html">fold</a></i>
utilities can be used to achieve reasonable formatting
for the implementation's default page size.
<p>
A portable application can use one of the
<i>file</i>
operands only with the
<b>-c</b>
option or if the file is publicly readable
and guaranteed to be available at the time of printing.
This is because the standard gives the implementation the
freedom to queue up the request for printing at some
later time by a different process that might not be able
to access the file.
</blockquote><h4><a name = "tag_001_014_1267">&nbsp;</a>EXAMPLES</h4><blockquote>
<ol>
<p>
<li>
To print file
<i>file</i>:
<pre>
<code>
lp -c file
</code>
</pre>
<p>
<li>
To print multiple files with headers:
<pre>
<code>
pr file1 file2 | lp
</code>
</pre>
<p>
</ol>
</blockquote><h4><a name = "tag_001_014_1268">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_1269">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="lpstat.html">lpstat</a></i>,
<i><a href="mailx.html">mailx</a></i>.
<br>
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
